﻿@model YQBlog.Models.ArticleModel
@using res = Resource.Views.Admin.Admin;
@{YQBlog.General.GeneralConfigInfo ci = ViewBag.CI as YQBlog.General.GeneralConfigInfo;}
@section MenuInfo{
<ul> 
    <li>@Html.ActionLink("-"+ res.ManagementHome+" -", "Index", "Admin")</li>
    <li class="selected">
        <span class="selected-arrow">&nbsp;</span>
        <a href="###">- @res.ContentManagement -</a>
        <ul>
            <li id="t1">@Html.ActionLink(res.Article, "AdminArticle", "Admin", new { tid = 1 }, null)</li>
            <li id="t2">@Html.ActionLink(res.SinglePage, "AdminArticle", "Admin", new { tid = 2 }, null)</li>
            <li id="t5" class="v10">@Html.ActionLink(res.Posts, "AdminArticle", "Admin", new { tid = 5 }, null)</li>
            <li id="t4">@Html.ActionLink(res.Album, "AdminArticle", "Admin", new { tid = 4 }, null)</li>
            <li id="t6">@Html.ActionLink(res.Message, "AdminArticle", "Admin", new { tid = 6 }, null)</li>
            <li id="l1">@Html.ActionLink(res.Comment, "AdminArticle", "Admin", new { layer = 1 }, null)</li>
            <li id="t7">@Html.ActionLink(res.CustomArea, "AdminArticle", "Admin", new { tid = 7 }, null)</li>
            <li id="t8">@Html.ActionLink(res.CustomGlobalArea, "AdminArticle", "Admin", new { tid = 8 }, null)</li>
        </ul>
    </li>
    <li>@Html.ActionLink("-" + res.Configuration + " -", "AdminBaseConfig", "Admin")</li>
    <li>@Html.ActionLink("-" + res.UserManagement + " -", "AdminUserList", "Admin")</li>
</ul>
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/kindeditor/kindeditor.js")" type="text/javascript"></script> 
<script src="@Url.Content("~/Scripts/kindeditor/lang/zh_CN.js")" type="text/javascript"></script> 


<div id="mainContent">
        <div id="leftBox">
          <div id="pagePath">
          @res.Location：@res.ModifyContent
          </div>
          <div id="forms" class="contentBox">
            <div class="contentBoxTop">
              <h3>@res.ModifyContent</h3>
                <ul class="switcherTabs">
                    <li class=""><a tar="#box-2">-@res.SEO-</a></li>
                    <li class="selected"><a tar="#box-1">-@res.BasicInformation- </a></li>
                </ul>
            </div>
            <div class="innerContent">
@using (Html.BeginForm())
{
            <div id="box-1" class="tab1-box" style="display: block;">
            @Html.HiddenFor(m => m.ID)
            @Html.HiddenFor(m => m.CreateDate)
            <div class="label">
               <div class="editor-label">
                    @Html.LabelFor(m => m.CateId)
                </div>
                <div class="editor-field">
                    @Html.DropDownList("CateId")
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(m => m.Title)
                </div>
                <div class="editor-field">
                    @Html.TextBoxFor(m => m.Title, new { style = "width: 850px;" })
                    @Html.ValidationMessageFor(m => m.Title)
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(m => m.Content)
                </div>
                <div class="editor-field clstxtarea">
                    @Html.TextAreaFor(model => model.Content, new { style = "width: 850px; height: 450px" })
                    @Html.ValidationMessageFor(m => m.Content)
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(m => m.Summary)
                    <span id="SummaryTxtCount">(300)</span>
                </div>
                <div class="editor-field clstxtarea">
                    @Html.TextAreaFor(model => model.Summary, new { style = "width: 850px; height: 50px" })
                    @Html.ValidationMessageFor(m => m.Summary)
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(m => m.Tags)
                </div>
                <div class="editor-field">
                    @Html.TextBoxFor(m => m.Tags, new { style = "width: 850px;" })
                    @Html.ValidationMessageFor(m => m.Tags)
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(model => model.ReplyPermit)
                </div>
                <div class="editor-field radios">
                    <input type="radio" value="1" name="ReplyPermit" id="ReplyPermit_y" @if (Model.ReplyPermit == 1)
                                                                                        {@Html.Raw("checked=\"checked\"")}/>
                    <label for="ReplyPermit_y">
                        @res.AllowComments</label>
                    <input type="radio" value="2" name="ReplyPermit" id="ReplyPermit_n" @if (Model.ReplyPermit == 2)
                                                                                        {@Html.Raw("checked=\"checked\"")}/>
                    <label for="ReplyPermit_n">
                         @res.NoComments</label>
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(model => model.Status)
                </div>
                <div class="editor-field radios">
                    <input type="radio" value="1" name="Status" id="Status_y"  @if (Model.Status == 1)
                                                                               {@Html.Raw("checked=\"checked\"")}/>
                    <label for="Status_y">
                        @res.ImmediateRelease</label>
                    <input type="radio" value="2" name="Status" id="Status_n"  @if (Model.Status == 2)
                                                                               {@Html.Raw("checked=\"checked\"")}/>
                    <label for="Status_n">
                        @res.SaveDraft</label>
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(model => model.IsCommend)
                </div>
                <div class="editor-field radios">
                    <input type="radio" value="1" name="IsCommend" id="IsCommend_y"  @if (Model.IsCommend == 1)
                                                                                     {@Html.Raw("checked=\"checked\"")}/>
                    <label for="IsCommend_y">
                        @res.Recommend</label>
                    <input type="radio" value="2" name="IsCommend" id="IsCommend_n"  @if (Model.IsCommend == 2)
                                                                                     {@Html.Raw("checked=\"checked\"")}/>
                    <label for="IsCommend_n">
                        @res.NoRecommended</label>
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(model => model.IsTop)
                </div>
                <div class="editor-field radios">
                    <input type="radio" value="1" name="IsTop" id="IsTop_y"  @if (Model.IsTop == 1)
                                                                             {@Html.Raw("checked=\"checked\"")}/>
                    <label for="IsTop_y">
                        @res.Top</label>
                    <input type="radio" value="2" name="IsTop" id="IsTop_n"  @if (Model.IsTop == 2)
                                                                             {@Html.Raw("checked=\"checked\"")}/>
                    <label for="IsTop_n">
                        @res.NoSticky</label>
                </div>
            </div>

            </div><!--end of #box-1-->
            <div style="display:none" id="box-2" class="tab1-box">

            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(m => m.SeoTitle)
                </div>
                <div class="editor-field clstxtarea">
                    @Html.TextAreaFor(model => model.SeoTitle, new { style = "width: 800px; height: 30px" })
                    @Html.ValidationMessageFor(m => m.SeoTitle)
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(m => m.SeoDescription)
                </div>
                <div class="editor-field clstxtarea">
                    @Html.TextAreaFor(model => model.SeoDescription, new { style = "width: 800px; height: 50px" })
                    @Html.ValidationMessageFor(m => m.SeoDescription)
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(m => m.Seokeywords)
                </div>
                <div class="editor-field clstxtarea">
                    @Html.TextAreaFor(model => model.Seokeywords, new { style = "width: 800px; height: 50px" })
                    @Html.ValidationMessageFor(m => m.Seokeywords)
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(m => m.SeoMetas)
                </div>
                <div class="editor-field clstxtarea">
                    @Html.TextAreaFor(model => model.SeoMetas, new { style = "width: 800px; height: 80px" })
                    @Html.ValidationMessageFor(m => m.SeoMetas)
                </div>
            </div>
            <div class="label">
                <div class="editor-label">
                    @Html.LabelFor(m => m.ReName)
                </div>
                <div class="editor-field">
                    @Html.TextBoxFor(m => m.ReName, new { style = "width: 800px;" })
                    @Html.ValidationMessageFor(m => m.ReName)
                </div>
            </div>

            </div><!--end of #box-2-->
                <p>
			    <input type="image" src="/Content/image/admin/bt_submit.gif" name="BtnSubmit" id="BtnSubmit">
                </p>
}
            </div>
          </div>
<hr>
          <div class="errorBox"><div class="errorBoxTop">&nbsp;</div>
              <div class="msgBoxContent errorIcon">
                <p>Error. Item update failed. </p>
                <p>Details for the error goes here (If you need to).</p>
              </div>
          </div>
          <div class="successBox">
          <div class="successBoxTop">&nbsp;</div>
              <div class="msgBoxContent successIcon">
              <p>Success! Item updated.</p>
              </div>
          </div>
          <hr>
      </div><!-- end of #leftBox -->
              
  </div><!-- end of #content -->


<script type="text/javascript">
    var currentitem = "@ViewBag.CurrentItem";
    $(function () {
        $("#" + currentitem).addClass("selected");
        var editorSummary = null;
        var editorContent = null;

        KindEditor.ready(function (K) {
            editorSummary = K.create('textarea[name="Summary"]',
            {
                allowImageUpload: true,
                uploadJson: '/BlogAdmin/Admin/UploadFile',
                afterCreate: function () {
                    $(this.edit.doc).keyup(function () { SummaryTxtKeyUp(); });
                }
                //               ,items: ['fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', '|', 'image', 'link']
            });

            editorContent = K.create('textarea[name="Content"]', {
                allowImageUpload: true,
                uploadJson: '/BlogAdmin/Admin/UploadFile'
                //                ,items: [
                //'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                //'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                //'insertunorderedlist', '|', 'emoticons', 'image', 'flash', 'media', 'insertfile', 'table', 'link']
            });
        });

        function SummaryTxtKeyUp() {
            editorSummary.sync();
            var summarytxt = $('#Summary').val();
            $("#SummaryTxtCount").html('(' + (300 - summarytxt.length) + ')');
        }

        $("#BtnSubmit").click(function () {
            if (/^[0-9]+$/.test($("#ReName").val())) {
                alert("@res.PageRenameTip");
                return false;
            }
            editorSummary.html(ReplaceKESpace(editorSummary.html()));
            editorSummary.sync();
            editorContent.html(ReplaceKESpace(editorContent.html()));
            editorContent.sync();
        });


        $(".switcherTabs li").click(function () {
            var tar = $(this).find("a").attr("tar");
            $(this).addClass("selected").siblings("li").removeClass("selected");
            $(".tab1-box").hide();
            $(tar).show();
        });

    });
</script> 
